package com.zcdyy.rentalofhouse.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.TypedValue;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.zcdyy.rentalofhouse.R;
import com.zcdyy.rentalofhouse.utils.BaseTranslucentActivity;
import com.zcdyy.rentalofhouse.utils.TextUtilsForFont;

public class MoreDescActivity extends BaseTranslucentActivity {
    private Toolbar toolBar;
    private ImageView ivBack;
    private TextView tvSaveBack;
    private EditText etDesc;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_more_desc);

        initTitle();
        initView();
    }

    private void initTitle() {
        toolBar = (Toolbar) findViewById(R.id.toolBar);
        toolBar.setTitle("");
        setSupportActionBar(toolBar);
        toolBar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        ((TextView) findViewById(R.id.tv_title)).setTextSize(TypedValue.COMPLEX_UNIT_PX,
                TextUtilsForFont.getFontSize(MoreDescActivity.this, 35));
        setOrChangeTranslucentColor(toolBar, null, getResources().getColor(R.color.colorBlue));
    }

    private void initView() {
        tvSaveBack = (TextView) findViewById(R.id.tv_save_back);
        etDesc = (EditText) findViewById(R.id.et_desc);
        tvSaveBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String str = etDesc.getText().toString();
                Intent intent = new Intent(MoreDescActivity.this, WholeRentDetailsActivity.class);

                if (!str.equals("")){
                    intent.putExtra("desc", str);
                }else {
                    intent.putExtra("desc","  ");
                }
                setResult(888,intent);
                finish();
            }
        });



    }
}
